<template>
	<view>
		<navbar :parameter='parameter'></navbar>
		<view class="list-box">
			<block v-for="(item,index) in rankList" :key="index">
				<navigator class="list-item acea-row" :url="'/bundle/pages/insure/insure_details?id='+item.id">
					<image :src="imageUrl+item.album_images" mode="aspectFill"></image>
					<view class="cont-box">
						<view class="line acea-row row-between-wrapper">
							<view> 专员：<text>{{item.name}}</text></view>
						</view>
						<view class="line acea-row row-between-wrapper">
							<view> 性别：<text>{{item.sex}}</text></view>
							<view> 学历：<text>{{item.education}}</text></view>
						</view>
						<view class="line acea-row row-middle">
							综合评分：<u-rate :value="item.comprehensive_score" readonly activeColor="#FFA731"
								inactiveColor="#EDEDEC">
							</u-rate> <text class="score">{{item.comprehensive_score}}</text>
						</view>
						<view class="btn acea-row row-center-wrapper">我要选TA</view>
					</view>
				</navigator>
			</block>
		</view>
		<u-loadmore :status="status" line dashed @loadmore="loadmore"  v-if="rankList.length > 0"/>
		<u-empty mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png" text="暂无保险专员" v-else></u-empty>
	</view>
</template>

<script>
	let app = getApp();
	export default {
		data() {
			return {
				parameter: {
					'navbar': '1',
					'return': '1',
					'title': '保险专员',
					'color': false,
				},
				imageUrl: this.imageUrl,
				rankList: [],
				area_id: app.globalData.area_id,
				// 加载更多
				status: 'loadmore',
				limit: 10,
				page: 1,
				total_num: '',
			};
		},
		onLoad() {
			this.lists(1);
		},
		onShow() {

		},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {
		
		},
		onShareTimeline(res) { //分享到朋友圈
		
		},
		onReachBottom() {
			this.loadmore()
		},
		methods: {
			async lists(page) {
				var that = this;
				const res = await this.$myRequest({
					url: '/api/index/bxzy_lists',
					data: {
						hid: uni.getStorageSync('hospital_id'),
						page: page,
						limit: 10
					}
				})
				this.rankList = [...this.rankList, ...res.data.data];
				this.total_num = res.data.total_num;
			},
			loadmore() {
				console.log(11111)
				if (this.total_num == this.rankList.length) {
					this.status = 'nomore';
				} else {
					this.status = 'loading';
					this.page++;
					this.lists(this.page);
				}
				setTimeout(() => {
					if (this.total_num == this.rankList.length) this.status = 'nomore';
					else this.status = 'loading';
				}, 2000)
			}
		}
	}
</script>
<style>
	page {
		background-color: #fff !important;
	}
</style>
<style lang="scss" scoped>
	.list-box {
		padding: 0 30rpx;
		position: relative;
	}

	.search-box {
		width: 100%;
		height: 70rpx;
		border-radius: 14rpx;
		border: 1px solid #DEDEDE;
		color: rgba(153, 153, 153, 0.502);
		padding: 0 30rpx;
		font-size: 24rpx;
	}

	.search-box .iconfont {
		font-size: 42rpx;
		margin-right: 30rpx;
	}

	.search-box input {
		color: #333;
	}

	.tab-box {
		padding: 30rpx;
		height: 100rpx;
		position: relative;
	}

	.tab-box .tab-item {
		width: 33.3%;
		text-align: center;
	}


	.tab-box .tab-item image {
		width: 15rpx;
		height: 19rpx;
		margin-left: 10rpx;
	}

	.tab-box .tab-item.active {
		color: #347dfe;
	}

	.tab-box .tab-item.active .tit {
		font-size: 30rpx;
	}


	.list-item {
		margin-bottom: 40rpx;
	}

	.list-item image {
		width: 30%;
		height: 218rpx;
	}

	.list-item .cont-box {
		width: 70%;
		padding-left: 20rpx;
		font-size: 26rpx;
	}

	.list-item .cont-box .line {
		padding-bottom: 16rpx;
		color: #525252;
	}

	.list-item .cont-box .line text {
		color: #020006;
	}

	.list-item .cont-box .line .score {
		color: #347dfe;
		padding-left: 10rpx;
		margin-top: 4rpx;
	}

	.list-item .cont-box .btn {
		width: 160rpx;
		height: 50rpx;
		color: #fff;
		background-color: #347DFE;
		border-radius: 40rpx;
		font-size: 24rpx;
		margin-top: 6rpx;
	}
</style>
